#							-*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69])
AC_INIT([datop], [v1.0], [])
AM_INIT_AUTOMAKE([-Wno-portability no-dist-gzip dist-xz foreign subdir-objects])
AC_CONFIG_SRCDIR([src/datop.c])
AC_CONFIG_HEADERS([config.h])
LT_INIT
AC_CONFIG_MACRO_DIRS([m4])

AC_CANONICAL_HOST
AM_CONDITIONAL(CPU_INTEL, test "x$host_cpu" = "xx86_64")
AM_CONDITIONAL(CPU_AARCH64, test "x$host_cpu" = "xaarch64")

# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL

# Checks for libraries.
AC_CHECK_LIB([numa], [numa_free])
AC_CHECK_LIB([pthread], [pthread_create])

PKG_CHECK_MODULES([CHECK], [check])

AC_SEARCH_LIBS([delwin], [ncursesw ncurses], [],
			   [AC_MSG_ERROR([ncurses is required but was not found])], [])

# Checks for header files.
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h locale.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_INT64_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MMAP
AC_FUNC_REALLOC
AC_FUNC_STRTOD
AC_CHECK_FUNCS([getpagesize gettimeofday memset munmap select strcasecmp strchr strcspn strstr strtol strtoull])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT
